# -*- mode: python; -*-

Import('env')

def modify_targets(target, source, env):
    # Add the .h version of the .cc
    target.append(str(target[0])[:-2] + 'h')
    return target, source

ProtocBuilder = Builder(action = 'protoc --cpp_out=. ${SOURCES.file}',
                        suffix = '.pb.cc',
                        src_suffix = '.proto',
                        chdir=1,
                        emitter = modify_targets)

local_env = env.Copy()
local_env.Append(BUILDERS={'Protoc' : ProtocBuilder})
sources = local_env.Protoc('messages.proto')

Return('sources')
